package org.example;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class StudentText {
    @Autowired
    Student student;

    ApplicationContext context;
    @Before
    public void init(){
        context=new ClassPathXmlApplicationContext("applicationContext.xml");
    }
    @Test
    public void test1() {
        //Student student = context.getBean("student", Student.class);
        //student.setName("张三");
        student.showme();
    }
}
